import { createStore } from 'redux'
// createStore(函数, 初始值, 中间件)  返回值(store对象)    创建仓库

// 初次执行会调用reducer函数

// reducer(state, action)
let reducer = (state, { type }) => {
    switch(type) {
        case 'ADD':
            state.count += 1
            return state
        case 'DEL':
            state.count -= 1
            return state 
        default:
            return state
    }
}

let initState = {
    count: 8888,
    num: 11111111
}

let store = createStore(reducer, initState)
// 测试
window.store = store


export default store

